/*

This do file produces the main results tables and figures in the main body of
the article: Wood, T, Hoy, C & Pryke, J, "The effect of geostrategic competition 
on public attitudes to aid", Journal of Experimental Political Science.

This do file is focused on the NEW ZEALAND DATA.

Please email all questions to: terence.wood@anu.edu.au/terencewoodnz@gmail.com

This file does the following:

1. Preliminaries
2. Loops through each of the dependent variables of interest running a
   bivariate regression in which treatment group is the independent variable 
   and the control group is the comparator.
3. Exports the outputs of the regressions for all dependent variables of interest
   as a single table in an rtf file. (Table 2 in paper.)

Do file coded in Stata version 14. 

You need to install the estout package before running this code:
http://repec.sowi.unibe.ch/stata/estout/
	
*/

********************************************************************************
********************************Preliminaries***********************************
********************************************************************************

set more off

cd "ENTER YOUR WORKING DIRECTORY HERE"

use "2 NZ data JEPS FINAL", clear

********************************************************************************
*********************OLS regression based estimates of effect*******************
********************************************************************************

estimates clear

foreach question in toomuchaid morepac favournz {

	if "`question'" == "toomuchaid" {
		local qtitle "Too much aid"
		}
		else if "`question'" == "morepac" {
		local qtitle "More to Pacific"
		}
		else if "`question'" == "favournz" {
		local qtitle "Help NZ"
		}

	if "`question'" == "toomuchaid" {
		local mname tma
		}
		else if "`question'" == "morepac" {
		local mname pf
		}
		else if "`question'" == "favournz" {
		local mname nz
		}

	//Regression against control
	qui reg `question' i.treatment
	estimates store `mname', title("`qtitle'")


}

esttab tma pf nz using NZresults.rtf, append b(2) se(2) ///
label mtitle nobase starlevel(* 0.1 ** 0.05 *** 0.01) nonotes nonumber nogaps ///
coeflabels(_cons "Control group mean") ///
addnote("Standard errors in parentheses; * p<0.1, ** p<0.05, *** p<0.01")

macro drop _all 
 
estimates clear
